package org.zfes.snowier.cloud.zbss.widget.act.model;
import org.zfes.snowier.common.dao.IBaseModel;
import org.zfes.snowier.core.util.ZDateUtil;
public class ActSubjectJoinHis extends IBaseModel{

	private static final long serialVersionUID = 1L;
	
	public ActSubjectJoinHis() {}
	public ActSubjectJoinHis(Long id) {
		this.setId(id);
	}
	public ActSubjectJoinHis(Long subjectId, Long userId) {
		super();
		this.subjectId = subjectId;
		this.userId = userId;
	}
	
	//<-------------------------------------------->

	@javax.validation.constraints.NotNull(message="所属课堂不能为空")
	  private java.lang.Long subjectId;
	@javax.validation.constraints.NotNull(message="答题者不能为空")
	  private java.lang.Long userId;
	@javax.validation.constraints.NotBlank(message="答题者不能为空")
	@javax.validation.constraints.NotNull(message="答题者不能为空")
	@org.hibernate.validator.constraints.Length(min=0,max=50,message="答题者长度不能大于50")
	  private java.lang.String userName;
	@javax.validation.constraints.NotNull(message="创建时间不能为空")
	  private java.util.Date opTime;
	@javax.validation.constraints.NotNull(message="操作类型不能为空")
	  private java.lang.Byte opType;
	
	public static ActSubjectJoinHis genLeft(Long subjectId, Long joinUserId) {
		ActSubjectJoinHis his=new ActSubjectJoinHis( subjectId,  joinUserId).setOpTime(ZDateUtil.newDate()).setOpType(Byte.valueOf("2"));
		return his;
	}
	public static ActSubjectJoinHis genEnter(ActSubjectJoin join) {
		ActSubjectJoinHis his=new ActSubjectJoinHis();
		his.setSubjectId(join.getSubjectId())
		.setUserId(join.getJoinUserId())
		.setUserName(join.getJoinUserName())
		.setOpTime(ZDateUtil.newDate())
		.setOpType(Byte.valueOf("1"));
		return his;
	}
	public static ActSubjectJoinHis genLeft(ActSubjectJoin join) {
		ActSubjectJoinHis his=new ActSubjectJoinHis();
		his.setSubjectId(join.getSubjectId())
		.setUserId(join.getJoinUserId())
		.setUserName(join.getJoinUserName())
		.setOpTime(ZDateUtil.newDate())
		.setOpType(Byte.valueOf("2"));
		return his;
	}
	//<-------------------------------------------->
	public ActSubjectJoinHis setSubjectId(java.lang.Long subjectId){
	 this.subjectId=subjectId;
	 return this;
	}
	public java.lang.Long getSubjectId(){
		return this.subjectId;
	}
	public ActSubjectJoinHis setUserId(java.lang.Long userId){
	 this.userId=userId;
	 return this;
	}
	public java.lang.Long getUserId(){
		return this.userId;
	}
	public ActSubjectJoinHis setUserName(java.lang.String userName){
		this.userName=userName==null?null:userName.trim();
	 return this;
	}
	public java.lang.String getUserName(){
		return this.userName;
	}
	public ActSubjectJoinHis setOpTime(java.util.Date opTime){
	 this.opTime=opTime;
	 return this;
	}
	public java.util.Date getOpTime(){
		return this.opTime;
	}
	public ActSubjectJoinHis setOpType(java.lang.Byte opType){
	 this.opType=opType;
	 return this;
	}
	public java.lang.Byte getOpType(){
		return this.opType;
	}

}
